<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>出库调度单（点击调度）</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.css" rel="stylesheet">
    <style>
        .text_no_border{
            border: none;
        }
    </style>
</head>
<body>
<div style="color: #0e9aef">您正在做的业务是：库存管理--出入库调度管理--制定出库单</div>

<div class="container">
    <div style="text-align: right">
        <button class="btn btn-default" id="s_btn">提交</button>
        <button class="btn btn-default" onclick="javascript:history.back()">返回</button>
    </div>

    <div class="panel panel-default" style="margin-top: 5px;">
        <div class="page-heading">
            <div class="panel-title">
                <h2 style="text-align: center;margin-top: 20px;">出库调度单</h2>
            </div>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" id="outbound_scheduling_form">
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">出库单编号：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="payId" name="payId">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品编号：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="productId" name="productId">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品名称：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="productName" name="productName">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">成本单价：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="costPrice" name="costPrice">
                        </div>
                    </div>
                </div>
                <div class="form-group">
<!--                    <div class="col-md-6">-->
<!--                        <label class="control-label col-md-4">当前库存数量：</label>-->
<!--                        <div class="col-md-8">-->
<!--                            <input type="text" class="form-control" readonly-->
<!--                                   style="border: none;background-color: white;"-->
<!--                                   id="" name="">-->
<!--                        </div>-->
<!--                    </div>-->
                    <div class="col-md-6">
                        <label class="control-label col-md-4">本次出库数量：</label>
                        <div class="col-md-8">
                            <input type="text" class="form-control"
                                   style="border: none;border-bottom: 1px solid black;"
                                   id="paidAmount" name="paidAmount">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">应出库数：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="amount">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">已出库数：</label>
                        <div class="col-md-8">
                            <input type="text" class="text_no_border form-control"
                                   readonly style="background-color: white;" id="paidAmount1">
                            <input type="hidden" name="id" id="id">
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>








<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<script src="/js/currentTime.js"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>


<script>
    $(function (){
        let detailId =localStorage.getItem("detailId")
        let pid = localStorage.getItem("pid")
        $("#outbound_scheduling_form #payId").val(pid)
        $.post("/storage/pay/getDetailId",{"detailId":detailId},function (res){
            $("#outbound_scheduling_form #productId").val(res.productId)
            $("#outbound_scheduling_form #id").val(res.id)
            $("#outbound_scheduling_form #productName").val(res.productName)
            $("#outbound_scheduling_form #costPrice").val(res.costPrice)
            $("#outbound_scheduling_form #amount").val(res.amount)
            $("#outbound_scheduling_form #paidAmount1").val(res.paidAmount)
        })

        $("#s_btn").click(function (){
            let num = $("#outbound_scheduling_form #amount").val()
            let num1 = $("#outbound_scheduling_form #paidAmount").val()
            if(num1!=num){
                alert("输入数量不对，请重新输入")
                return
            }
            let parms=$("#outbound_scheduling_form").serialize()
            let pid= $("#outbound_scheduling_form #payId").val()
            $.post("/storage/pay/modifyPay",parms,function (res){
                if(res){
                    $.post("/storage/pay/judgmentComplete",{"pid":pid},function (data){
                        if(data){
                            window.location="draw_up_outbound_orderUI"
                        }else {
                            window.location="outbound_dispatch_orderUI"
                        }
                    })
                }
            })
        })
    })
</script>

</body>
</html>